﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;

namespace CoreCms.Net.Utility.Helper
{
    public static class PayHelper
    {

        /// <summary>
        /// 获取微信支付类型
        /// </summary>
        /// <param name="tradeType"></param>
        /// <returns></returns>
        public static string GetWeiChatPayTradeType(string tradeType)
        {
            if (tradeType != GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString() &&
                tradeType != GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString() &&
                tradeType != GlobalEnumVars.WeiChatPayTradeType.NATIVE.ToString() &&
                tradeType != GlobalEnumVars.WeiChatPayTradeType.APP.ToString() &&
                tradeType != GlobalEnumVars.WeiChatPayTradeType.MWEB.ToString()
               )
                return GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
            //if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString())
            //    return GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
            return tradeType;
        }


        /// <summary>
        /// 获取支付宝支付类型
        /// </summary>
        /// <param name="tradeType"></param>
        /// <returns></returns>
        public static string GetAliPayPayTradeType(string tradeType)
        {
            if (tradeType != GlobalEnumVars.AliPayPayTradeType.JSAPI.ToString() &&
                tradeType != GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString() &&
                tradeType != GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString() &&
                tradeType != GlobalEnumVars.AliPayPayTradeType.APP.ToString() &&
                tradeType != GlobalEnumVars.AliPayPayTradeType.MWEB.ToString()
               )
            {
                return GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString();
            }
            return tradeType;
        }



    }
}
